<template>
  <div class="common-layout">
    <el-container>
      <el-aside :width="isNavFold ? '60px' : '210px'"
        ><NavMenu :isNavFold="isNavFold"
      /></el-aside>
      <el-container>
        <el-header><NavHeader @changeFold="changeFold" /></el-header>
        <el-main>Main</el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script lang="ts">
import NavMenu from '@/components/nav-menu'
import NavHeader from '@/components/nav-header'
import { defineComponent, ref } from 'vue'

export default defineComponent({
  components: { NavMenu, NavHeader },
  setup() {
    const isNavFold = ref(false)
    const changeFold = (isFold: boolean) => {
      isNavFold.value = isFold
    }
    return { changeFold, isNavFold }
  }
})
</script>

<style scoped lang="less">
/deep/ .el-aside {
  transition: width 0.3s;
  -webkit-transition: width 0.3s;
  -moz-transition: width 0.3s;
  -webkit-transition: width 0.3s;
  -o-transition: width 0.3s;
}
</style>
